<style lang="less">
@import "../../styles/common.less";
@import "./location.less";
</style>

<template>
    <div class="access">
        <Row>
            <Col span="18">
                <Card>
                    <p slot="title">
                        <Icon type="location"></Icon>
                        设备定位
                    </p>
                    <indoorMap ref="map"></indoorMap>
                </Card>
            </Col>
            <Col span="6" class="padding-left-10">
                <Card>
                    <p slot="title">
                        <Icon type="ios-medical"></Icon>
                        当前设备
                    </p>
                    <div>
                        <Input v-model="value" placeholder="设备ID" style="margin-bottom: 20px"></Input>
                    </div>
                    <div class="access-current-user-con">
                        <img src="../../images/device.jpg" alt="">
                        <p class="text-align-left">设备ID:<b>{{ ID }}</b></p>
                        <p class="text-align-left">设备名称:<b>{{ name }}</b></p>
                        <p class="text-align-left">所属科室:<b>{{ dept }}</b></p>
                        <p class="text-align-left">价值:<b>￥{{ value }}</b></p>
                        <p class="text-align-left">状态:<b :style="{color: status==='inUse'?'green':'red'}">{{ status==='inUse'?'使用中':'未使用' }}</b></p>
                        <p class="text-align-left">平均单日运转:<b>{{ avgRunTime }}小时</b></p>
                        <p class="text-align-left">最后启动:<b>{{ lastRun }}</b></p>
                    </div>
                </Card>
            </Col>
        </Row>
    </div>
</template>

<script>
import Cookies from "js-cookie";
require("../../assets/Indoor.css");
import Indoor from "../../assets/Indoor.js";
import indoorMap from "../my-components/indoorMap.vue";
window.NGR = Indoor;

export default {
  name: "access_index",
  components: {
    indoorMap
  },
  data() {
    return {
      accessCode: parseInt(Cookies.get("access")),
      switchValue: parseInt(Cookies.get("access")) === 1,
      ID: "D3247812",
      name: "核磁共振仪",
      dept: "测试科室",
      value: "1300000",
      status: "inUse",
      avgRunTime: "3.7",
      lastRun: "2018-02-12 13:38:49"
    };
  },
  computed: {
    avatorPath() {
      return localStorage.avatorImgPath;
    }
  },
  methods: {
    changeAccess(res) {
      if (res) {
        this.accessCode = 1;
        Cookies.set("access", 1);
      } else {
        this.accessCode = 0;
        Cookies.set("access", 0);
      }
      this.$store.commit("updateMenulist");
    }
  }
};
</script>

<style>

</style>
